import { CarInfo } from './../car_info/car_info.entity';
import {
  Column,
  Entity,
  JoinColumn,
  OneToOne,
  PrimaryGeneratedColumn,
} from 'typeorm';
import { User } from '../user/user.entity';

@Entity('order_list')
export class Order {
  @PrimaryGeneratedColumn({
    comment: '订单id',
  })
  order_id: number;

  @Column({
    comment: '汽车id',
  })
  car_id: number;

  @OneToOne(() => CarInfo, (CarInfo) => CarInfo, { eager: true })
  @JoinColumn({ name: 'car_id' })
  carInfo: CarInfo;

  @Column({
    comment: '订单状态',
  })
  state: number;

  @Column({
    comment: '用户id',
  })
  user_id: number;

  @OneToOne(() => User, (User) => User, { eager: true })
  @JoinColumn({ name: 'user_id' })
  user: User;
}
